use strict;
use warnings;

use Dogtanian;
use LWP::Simple;
use XML::Feed;
use DateTime;

my %feeds;
{
	my $now = DateTime->now();
	%feeds = map { $_ => $now } XML::Feed->find_feeds('http://code.google.com/p/opendchub-bot/source/list');
}

every 15 => sub {
	while (my ($url, $last_modified) = each(%feeds)) {
		my $feed = XML::Feed->parse(URI->new($url)) or die XML::Feed->errstr;

		for (reverse $feed->entries) {
			if ($_->modified > $last_modified) {
				say ($_->title . ": " . $_->link);
				$feeds{$url} = $_->modified;
			}
		}
	}
};
